<template>
  <view class="home">
    <view class="wz-top">
      <image src="/static/topbj.png" mode="" class="topbjs"></image>
      <view class="cont">
        <view class="c-itemsa">
          往期活动
        </view>
      </view>
    </view>


    <!--搜索  -->
    <view class="splendid_search">
      <!-- <u-search :show-action="false" @focus='goSearch()'></u-search> -->
      <view class="search" @click='goSearch()'>
        <u-icon name="search" size="30"></u-icon>
        <view class="tt">
          请输入关键词
        </view>
      </view>

      <view class="sort">
        <view :class="flag==1 ? 'active' : ''" @click="flag=1">全部活动
          <image v-if="flag==1 " class="line1" src="../../static/imgs/Ellipse143.png" mode=""></image>
        </view>
        <view :class="flag==2 ? 'active' : ''" @click="flag=2">进行中活动
          <image v-if="flag==2 " class="line1" src="../../static/imgs/Ellipse143.png" mode=""></image>
        </view>
        <view :class="flag==3 ? 'active' : ''" @click="flag=3">往期活动
          <image v-if="flag==3 " class="line1" src="../../static/imgs/Ellipse143.png" mode=""></image>
        </view>
      </view>
    </view>

    <!-- content全部活动 -->
    <view class="content" v-for="item in 3">
      <view style="position: relative;">
        <image src="../../static/imgs/Rectangle 548.png" mode="" style="width: 622rpx;height: 348rpx;"></image>
        <view class="chakan">
          <u-icon name="eye-fill" color="#FFF" style="vertical-align: middle;"></u-icon>
          <text>1238</text>
        </view>
      </view>
      <view class="title">
        长清大学生红叶谷汉服真人秀开团
      </view>
      <view class="under_way" v-if="active">活动火热进行中</view>
      <view class="under_way_active" v-else>活动已结束</view>
      <view class="contents">报名时间：2023月6日24-2023年7月24日</view>
      <view class="contents">截止时间：2023-7-31</view>
      <view class="contents">可报名人数：60人</view>
      <view class="contents">剩余名额：10人</view>
      <button class="button" v-if="active" @click="godetail()">立即查看</button>
      <button class="button_active" v-else @click="godetail()">立即查看</button>
    </view>

    <!-- 进行中活动 -->

  </view>
</template>

<script>
  export default {
    data() {
      return {
        flag: 1, // 切换
        active: true // 进行中  false 结束
      }
    },
    methods: {
      godetail() {
        uni.navigateTo({
          url: '/pages/events/events_proceed'
        })
      },
      goSearch() {
        uni.navigateTo({
          url: '/pages/search/search'
        })
      }
    }
  }
</script>

<style scoped lang="scss">
  .search {
    width: 622rpx;
    height: 62rpx;
    background: #F2F2F2;
    border-radius: 74rpx 74rpx 74rpx 74rpx;
    display: flex;
    align-items: center;
    color: #949494;
    font-size: 24rpx;
    padding-left: 40rpx;

    .tt {
      margin-left: 10rpx;
    }
  }

  .home {
    padding-bottom: 80rpx;
    background: #F5F5F5;

    .wz-top {
      background-color: #5bcce7;
      height: 180rpx;
      color: #333;
      position: relative;
      z-index: 1;

      .topbjs {
        width: 100%;
        height: 452rpx;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
      }

      .cont {
        padding: 0 20rpx;
        display: flex;
        position: relative;
        z-index: 2;

        .c-itemsa {
          line-height: 270rpx;
          width: 100%;
          display: flex;
          justify-content: center;
          font-size: 32rpx;
          font-family: PingFang SC-Bold, PingFang SC;
          font-weight: bold;
          color: #333333;
        }

      }

    }
  }

  // 搜索
  .splendid_search {
    margin: 50rpx 32rpx;
    padding: 32rpx;
    position: relative;
    z-index: 2;
    // width: 686rpx;
    height: 202rpx;
    background: #FFFFFF;
    box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(102, 102, 102, 0.1);
    border-radius: 20rpx 20rpx 20rpx 20rpx;

    .sort {

      margin-top: 35rpx;
      display: flex;
      justify-content: space-around;
      font-size: 28rpx;

      .active {
        font-size: 28rpx;
        font-weight: bold;
        color: #FAD74E;
        position: relative;
        display: inline-block;

        .line1 {
          position: absolute;
          left: 35%;
          bottom: -15rpx;
          width: 38rpx;
          height: 8rpx;
        }
      }
    }
  }

  // 
  .content {
    margin: 0 0 32rpx 32rpx;
    padding: 32rpx;
    width: 686rpx;
    height: 814rpx;
    background: #FFFFFF;
    box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(102, 102, 102, 0.1);
    border-radius: 20rpx 20rpx 20rpx 20rpx;

    .chakan {
      width: 100%;
      text-align: right;
      padding-right: 20rpx;
      padding-bottom: 25rpx;
      background: linear-gradient(360deg, #333333 0%, rgba(51, 51, 51, 0) 100%);
      border-radius: 0 0 20rpx 20rpx;
      font-size: 24rpx;
      color: #FFFFFF;
      position: absolute;
      // right: 20rpx;
      bottom: 7rpx;

      >text {
        margin-left: 5rpx;
      }
    }


    .title {
      margin: 25rpx 0 20rpx;
      font-size: 28rpx;
      font-weight: bold;
      color: #333333;
    }

    .under_way {
      margin-bottom: 20rpx;
      width: 226rpx;
      line-height: 40rpx;
      color: #FF3434;
      background: #FFE7E7;
      border-radius: 4rpx 4rpx 4rpx 4rpx;
      text-align: center;
      font-size: 24rpx;
    }

    .under_way_active {
      margin-bottom: 20rpx;
      width: 226rpx;
      line-height: 40rpx;
      color: #8F8F8F;
      background: #EDEDED;
      border-radius: 4rpx 4rpx 4rpx 4rpx;
      text-align: center;
      font-size: 24rpx;
    }

    .contents {
      margin-bottom: 10rpx;
      font-size: 24rpx;
      font-weight: 500;
      color: #333333;
    }

    .button {
      margin-top: 35rpx;
      width: 622rpx;
      line-height: 60rpx;
      color: #FFFFFF;
      background: linear-gradient(92deg, #FF7070 0%, #FF4E4E 100%);
      border-radius: 82rpx 82rpx 82rpx 82rpx;
      font-size: 28rpx;
    }

    .button_active {
      margin-top: 35rpx;
      width: 622rpx;
      line-height: 60rpx;
      color: #333333;
      background: linear-gradient(92deg, #F7D860 0%, #F3C721 100%);
      border-radius: 82rpx 82rpx 82rpx 82rpx;
      font-size: 28rpx;
    }
  }
</style>